import { UPDATECITY } from './type'

import { mapMutations } from 'vuex'

import Vue from 'vue'
<<<<<<< HEAD
import axios  from 'axios'
export default {
    async  updateCityAsync({ commit, state }, { city }) {
    // alert(100)
=======
import axios from 'axios'
export default {
  async  updateCityAsync({ commit, state }, { city }) {
>>>>>>> e7617aa47937d6a0a7547f5c8938bb8805ae057b
    if (!city.name) {
      city.name = state.name
      city.rN = state.rN
    }
<<<<<<< HEAD
    // let url=`/movie/hot/?city=${city.rN}`;
    // let data=await this.$axios.get(url)
    // alert('city')
    // return Vue.http.get(`/movie/hot/?city=${city.rN}`).then((response) => {
    //   let data = response.data
    //   let lists = data.data.data.returnValue;
    //   // console.log(lists);
    //   //模拟索引数据的id号
    //   lists.forEach((item, index) => {
    //     item.mID = index
    //   })
    //   city.data = lists
    //   console.log('city');
    //   commit(UPDATECITY, { city })

    // })
       let data =   await  axios.get(`/movie/hot/?city=${city.rN}`)
      //  console.log(data);
       let lists = data.data.data.returnValue;

          //模拟索引数据的id号
=======
      let data=await axios.get(`/movie/hot/?city=${city.rN}`)
      let lists = data.data.data.returnValue;
      // console.log(lists);

      //模拟索引数据的id号
>>>>>>> e7617aa47937d6a0a7547f5c8938bb8805ae057b
      lists.forEach((item, index) => {
        item.mID = index
      })
      city.data = lists
<<<<<<< HEAD
      // console.log('city');
      console.log(city);
      
      
      commit(UPDATECITY, { city })

       
=======
    
      commit(UPDATECITY, { city })

  
>>>>>>> e7617aa47937d6a0a7547f5c8938bb8805ae057b
  }
}
